package com.summer.bilibili.domain.provider;

import com.baomidou.mybatisplus.extension.toolkit.Db;
import com.summer.bilibili.domain.video.VideoChannel;
import com.summer.bilibili.form.OptionsProvider;
import com.summer.bilibili.model.Option;

import java.util.List;
import java.util.stream.Collectors;

/**
 * 视频频道
 */
public class ChannelProvider implements OptionsProvider {
    @Override
    public List< Option > getOptions() {
        return Db.lambdaQuery( VideoChannel.class)
                .eq(VideoChannel::getPid, 0)
                .eq(VideoChannel::getDisabled, 0)
                .list()
                .stream()
                .map(a -> new Option(a.getChannelName(), a.getId()))
                .collect(Collectors.toList());
    }
}
